<!doctype html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../plugins/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="../css/global.css" media="all">
    <link rel="stylesheet" href="../css/table.css" />
  </head>
  <body>
    <div class="admin-main">
        <form class="layui-form">
        <div id="selectId" class="layui-form-item"></div>
        </form>
        <div>
            1 作者：citySelect.js代码 码云地址： https://gitee.com/Agger/codes/ednq2b367g4fu8rk5tosy20#0-sqq-1-34633-9737f6f9e09dfaf5d3fd14d775bfee85
        </div>
        <div>
            2 参数：
            <br/>
            <img src="../images/region.png" />
        </div>
        <div>
            3.方法：
            <br/>
            <pre class="layui-code">
            1 禁用启用：citySelect.disabled("addRegion",true);  //参数一位配置的id 参数二表示禁用还是启用
            2 重载：citySelect.reload("addRegion",{   //参数一位插件配置的id,参数二可以为配置参数的所有字段
                          selectedArr:[],
                          disabled:true
                   });
            3 获取所选值：citySelect.values("addRegion");  //参数为插件配置的id，返回值为数组，分别为省市区的选择值，未选择为空
            </pre> 
        </div>
        
    </div>
  <script type="text/javascript" src="../plugins/layui/layui.js"></script>
  <script type="text/javascript" src="../datas/region.js"></script>
  <script>
      layui.config({
        base: '../extend/'
      });
      layui.use('citySelect', function() {  //与引用其他原始模块一样，引入citySelect模块
              var $ = layui.jquery,
              citySelect = layui.citySelect;
            
              //初始化
              citySelect.render({
                id:'addRegion',
                elem: '#selectId',
                //url:"../datas/regionList.json",
                data:regionData,    //设置本地数据渲染
                method:'get',
                //lableName:'行政区域',    //自定义表单名称    默认：'行政区域'
                //search:false,        //是否开启输入查询 默认：true
                //required:true,        //是否必选       默认：false
                msg:'省市区三级联动下拉选择',  //模块下的提示信息 默认：null
                selectedArr:[],    //默认选中数组        默认：[]response
                where:{},
                response: {
                  statusName: 'resultCode',
                  statusCode: 0,
                  msgName: 'msg',
                  dataName: 'result'
                },
                filed:{
                  area:true,    //是否启用区
                    regionId:'regionId',
                    regionName:'regionName',
                    //provinceName: "province",    //默认省份名称
                    //cityName : "city",      //默认城市名称
                    //areaName : "area",      //默认区县名称
                  },
                  done:function(res){
                          //成功回调函数
                  },
                  error:function(res,e,m){
                          //失败回调函数
                }
              });
            });
    </script>
  </body>
</html>
